<template>
	<view>
		商品列表
		https://static.mcake.com/data/pages/wap/home/665.json?t=1655040694417
		https://h5.mcake.com/api/0434b49d1ac28f9d?cityId=110&page=1&bid=1
		大分类
		https://h5.mcake.com/api/5e90690f0e270d04?cityId=665
		
		access-token: 5157377197598e5fae68e32ae22ac560
		version: v1.0
		
		<button type="primary" @tap="group">分类</button>
		<button type="primary" @tap="goods">列表</button>
		<button type="warn" @tap="doimg">手动</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			group(){
				uni.request({
					url:"https://h5.mcake.com/api/5e90690f0e270d04?cityId=665",
					method:"GET",
					header:{
						"access-token": "5157377197598e5fae68e32ae22ac560",
						"version": "v1.0"
					},
					success: (res) => {
						// console.log(JSON.parse(JSON.stringify(res.data.data)));
						let list = [];
						res.data.data.map(v=>{
							list.push({
								"method": "POST",
								"path": "/1.1/classes/group",
								"body": v
							})
						})
						console.log(list);
						this.$post(
							"/1.1/batch",
							{
							    "requests": list
							}
							
						).then((res)=>{
							console.log(res);
						})
						
					}
					
				})
			},
			goods(){
				uni.request({
					url:"https://h5.mcake.com/api/0434b49d1ac28f9d?cityId=665&page=4&bid=1",
					method:"GET",
					header:{
						"access-token": "a83827a3f11840a800cfad1361717538",
						"version": "v1.0"
					},
					success: (res) => {
						// console.log(JSON.stringify(res.data.data.list));
						let list = [];
						res.data.data.list.map(v=>{
							list.push({
								"method": "POST",
								"path": "/1.1/classes/list",
								"body": v
							})
						})
						console.log(list);
						this.$post(
							"/1.1/batch",
							{
							    "requests": list
							}
							
						).then((res)=>{
							console.log(res);
						})
						
					}
					
				})
			},
			doimg(){
				this.$post(
					"/1.1/batch",
					{"requests":[
						{
						    "method": "POST",
						    "path": "/1.1/classes/banner",
							"body":{
								"img": "https://mcake-oss.oss-cn-hangzhou.aliyuncs.com/file/1b553ceeeaebb98a/5d13ed8857f4e3d6.jpg",
								"link":"https://h5.mcake.com/?key1=hd_banner&key2=xinren2022#/active?id=2236&type=2"
							}
						},
						{
						    "method": "POST",
						    "path": "/1.1/classes/banner",
							"body":{
								"img": "https://mcake-oss.oss-cn-hangzhou.aliyuncs.com/file/d47485d899f34038/103562f89712e0ed.jpg",
								"link":"https://h5.mcake.com/#/getCouponPage?id=91"
							}
						},
						{
						    "method": "POST",
						    "path": "/1.1/classes/banner",
							"body":{
								"img": "../../static/img/banner.jpg",
								"link":"https://www.baidu.com"
							}
						}
					]}
					
				).then((res)=>{
					console.log(res);
				})
			}
		}
	}
</script>

<style>

</style>
